// pages/Main/mainIndex/mainIndex.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    dati: [
      {
        "datiNum": "第一题",
        "select": 1
      },
      {
        "datiNum": "第二题",
        "select": 2
      },
      {
        "datiNum": "第三题",
        "select": 3
      },
      {
        "datiNum": "第四题",
        "select": 4
      },
      {
        "datiNum": "第五题",
        "select": 5
      },
      {
        "datiNum": "第六题",
        "select": 6
      },
      {
        "datiNum": "第七题",
        "select": 7
      },
      {
        "datiNum": "第八题",
        "select": 8
      },
    ],
    datiSelect: 0,//判断是否选中
    xiaoti: [
      {
        "xiaotiNum": "第1题",
        "select2": 1
      },
      {
        "xiaotiNum": "第2题",
        "select2": 2
      },
      {
        "xiaotiNum": "第3题",
        "select2": 3
      },
      {
        "xiaotiNum": "第4题",
        "select2": 4
      },
      {
        "xiaotiNum": "第5题",
        "select2": 5
      },
      {
        "xiaotiNum": "第6题",
        "select2": 6
      },
      {
        "xiaotiNum": "第7题",
        "select2": 7
      },
      {
        "xiaotiNum": "第8题",
        "select2": 8
      },
      {
        "xiaotiNum": "第9题",
        "select2": 9
      },
      {
        "xiaotiNum": "第10题",
        "select2": 10
      },
      {
        "xiaotiNum": "第11题",
        "select2": 11
      },
      {
        "xiaotiNum": "第12题",
        "select2": 12
      },
    ],
    xiaotiSelect: 0,//判断是否选中
    items: [
      { name: 'A', value: 'A.    have met,haven not they' },
      { name: 'B', value: 'B.    have met,haven they', checked: 'true' },
      { name: 'C', value: 'C.    have met,haven not they' },
      { name: 'D', value: 'D.    have met,haven they' },
    ],
    daan: 'B',
    queren: '未确认',
    tijiao: '未提交',
    show: false,
    show2: false,
    color: false,
    like: false,
  },
  //大题选择
  chooseDati: function (data) {
    var that = this;
    that.setData({//把选中值放入判断值
      datiSelect: data.currentTarget.dataset.select
    })
  },
  //小题选择
  chooseXiaoti: function (data) {
    var that = this;
    that.setData({//把选中值放入判断值
      xiaotiSelect: data.currentTarget.dataset.xtselect
    })
  },
  onClickShow: function (e) {
    if (this.data.show2 == true) {
      this.setData({
        show2: false,
        show: !this.data.show
      })
    } else {
      this.setData({
        show: !this.data.show
      })
    }
  },
  onClickShow2: function (e) {
    if (this.data.show == true) {
      this.setData({
        show: false,
        show2: !this.data.show2
      })
    } else {
      this.setData({
        show2: !this.data.show2
      })
    }
  },
  radioChange: function (e) {
    console.log('radio发生change事件，携带value值为：', e.detail.value)
    this.setData({
      daan: e.detail.value,
    });
  },
  sure: function () {
    if (this.data.daan != '请选择答案') {
      this.setData({
        queren: '已确认',
        color: true,
      })
    }
    else {
      wx.showToast({
        title: '请选择答案',
        icon: 'none',
        duration: 2000
      })
    }
  },
  submit: function () {
    if (this.data.queren != '未确认') {
      this.setData({
        tijiao: '已提交',
        color: true,
      })
    }
    else {
      wx.showToast({
        title: '请确认',
        icon: 'none',
        duration: 2000
      })
    }
  },
  collect: function () {
    this.setData({
      like: !this.data.like
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  }, teacher: function () {
    wx.navigateTo({
      url: "../teacherOrder/teacherOrder"
    });
  }, parents: function () {
    wx.navigateTo({
      url: "../post/post"
    });
  }, student: function () {
    wx.navigateTo({
      url: "../post/post"
    });
  },
  answertw: function () {
    wx.navigateTo({
      url: "../answertw/answertw"
    });
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  onPageClick: function () {
    
      this.setData({
      show: false,
      show2:false,
        // needAnimation: false
      })
   
  },
  
})